package com.taijihuabao.modules.enums.optenums.checkin;

/**
 * 考勤打卡种类枚举
 *
 * @author Tu
 * @date 2022/1/4 19:23
 */
public enum CheckInWorkEnum {

    /**
     * 上班打卡
     */
    StartWork("1", "上班打卡"),
    /**
     * 下班打卡
     */
    OutWork("2", "下班打卡");


    private final String code;
    private final String message;

    CheckInWorkEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据状态code获取枚举名称
     *
     * @return
     */
    public static String getMessageByCode(String code) {
        for (CheckInWorkEnum status : CheckInWorkEnum.values()) {
            if (status.getCode().equals(code)) {
                return status.message;
            }
        }
        return null;
    }

    /**
     * 根据状态code获取枚举值
     *
     * @return
     */
    public static CheckInWorkEnum getByCode(String code) {
        for (CheckInWorkEnum status : CheckInWorkEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
